<?php /*a:1:{s:71:"D:\ROOTWWW\myCeshi\tpVue\app\admin\view\system\system_config\wechat.php";i:1594718206;}*/ ?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>公众号配置 - 派后台管理系统</title>
    <link rel="icon" href="/system/admin/favicon.ico" type="image/ico">
    <meta name="keywords" content="派后台管理系统">
    <meta name="description" content="派后台管理系统">
    <meta name="author" content="cfn">
    <link href="/system/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/system/admin/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/system/admin/css/style.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/system/admin/js/jconfirm/jquery-confirm.min.css">
</head>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <ul class="nav nav-tabs page-tabs">
                    <li <?php if($tab_id == '13'): ?>class="active"<?php endif; ?>><a href="/admin/system.system_config/wechat?tab_id=13">公众号</a></li>
                    <li <?php if($tab_id == '14'): ?>class="active"<?php endif; ?>><a href="/admin/system.system_config/wechat?tab_id=14">小程序</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active">
                        <form name="edit-form" id="edit-form" class="edit-form" onsubmit="return toSubmit()">
                            <?php if(is_array($system) || $system instanceof \think\Collection || $system instanceof \think\Paginator): $i = 0; $__LIST__ = $system;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;switch($vo['tag_type']): case "textarea": ?>
                            <div class="form-group">
                                <label for="<?php echo htmlentities($vo['form_name']); ?>"><?php echo htmlentities($vo['name']); ?></label>
                                <textarea class="form-control" id="<?php echo htmlentities($vo['form_name']); ?>" rows="5" name="<?php echo htmlentities($vo['form_name']); ?>" placeholder="请输入<?php echo htmlentities($vo['name']); ?>" ><?php echo htmlentities($vo['value']); ?></textarea>
                                <small class="help-block"><?php echo htmlentities($vo['remark']); ?></small>
                            </div>
                            <?php break; case "select": break; default: ?>
                            <div class="form-group">
                                <label for="web_site_title"><?php echo htmlentities($vo['name']); ?></label>
                                <?php switch($vo['form_type']): case "file": ?>
                                <div class="input-group">
                                    <input type="text" class="form-control" name="<?php echo htmlentities($vo['form_name']); ?>" id="<?php echo htmlentities($vo['form_name']); ?>" value="<?php echo htmlentities($vo['value']); ?>" />
                                    <input type="file" id="file<?php echo htmlentities($vo['form_name']); ?>" style="display: none;" onchange="upload('<?php echo htmlentities($vo['form_name']); ?>')"/>
                                    <div class="input-group-btn"><button class="btn btn-success" type="button" for-input="<?php echo htmlentities($vo['form_name']); ?>" onclick="btnClick('<?php echo htmlentities($vo['form_name']); ?>')">上传图片</button></div>
                                </div>
                                <?php break; case "radio": ?>
                                <div class="controls-box">
                                    <?php 
                                    foreach(explode("\n",$vo['param']) as $k=>$v)
                                    {
                                    $tmp = explode("=>",$v);
                                    $checked = $tmp[0] == $vo["value"] ? 'checked' : '';
                                    echo '<label class="lyear-radio radio-inline radio-primary">
                                            <input type="radio" name="'.$vo["form_name"].'" value="'.$tmp[0].'" '.$checked.'><span>'.$tmp[1].'</span>
                                        </label>';
                                    }
                                     ?>
                                </div>
                                <?php break; default: ?>
                                <input class="form-control" type="<?php echo htmlentities($vo['form_type']); ?>" id="web_site_title" name="<?php echo htmlentities($vo['form_name']); ?>" value="<?php echo htmlentities($vo['value']); ?>" placeholder="请输入<?php echo htmlentities($vo['name']); ?>" >
                                <?php endswitch; ?>
                                <small class="help-block"><?php echo htmlentities($vo['remark']); ?></small>
                            </div>
                            <?php endswitch; ?>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary m-r-5">确 定</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/system/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/system/admin/js/main.min.js"></script>
<script type="text/javascript" src="/system/admin/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/system/admin/js/lightyear.js"></script>
<script src="/system/admin/js/jconfirm/jquery-confirm.min.js"></script>
<script>
    /**
     * 选择文件
     * @param inputName
     */
    function btnClick(inputName) {
        $("#file"+inputName).click()
    }
    /**
     * 异步上传
     * @param inputName
     */
    function upload(inputName) {
        var formData = new FormData();
        formData.append("file",$("#file"+inputName)[0].files[0]);
        $.ajax({
            type:'POST',
            url:'/admin/widget.files/image',
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: function (res) {
                $("#"+inputName).val(res.data.filePath);
            }
        });
    }
    /**
     * 提交表单
     */
    function toSubmit(){
        $.post(
            url = '/admin/system.system_config/ajaxSave',
            data = $("#edit-form").serializeArray(),
            function (res) {
                //if (!Array.isArray(res)) res = jQuery.parseJSON(res);
                if (res.status === 200 || res.code === 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
                else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
            }
        );
        return false;
    }
</script>
</body>
</html>